import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.event.MouseInputAdapter;



public class MouseClickHandler extends MouseAdapter
{
	Game game;
	public MouseClickHandler(Game game) 
	{
		this.game = game;
	}
	@Override
	public void mousePressed(MouseEvent e) 
	{
		if (e.getButton() == MouseEvent.BUTTON1)
		{
			int mouseX = e.getX();
			int mouseY = e.getY();
			game.laser.updatePosition(game, mouseX, mouseY);
			game.freezeAt(mouseX - 400 + game.laser.offsetX, mouseY - 300 + game.laser.offsetY);
			
			game.leftClick = true;
			game.rightClick = false;
		}
		if (e.getButton() == MouseEvent.BUTTON3)
		{
			int mouseX = e.getX();
			int mouseY = e.getY();
			game.laser.updatePosition(game, mouseX, mouseY);
			game.meltAt(mouseX - 400 + game.player.x, mouseY - 300 + game.player.y);
			game.leftClick = false;
			game.rightClick = true;
		}
	}
	@Override
	public void mouseReleased(MouseEvent e) 
	{
		if (e.getButton() == MouseEvent.BUTTON1)
		{
			game.leftClick = false;
			game.rightClick = false;
		}
		if (e.getButton() == MouseEvent.BUTTON3)
		{
			game.leftClick = false;
			game.rightClick = false;
		}
	}
	
	

}
